﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Jaws.WebApp
{
    public partial class DefaultSiteMaster : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Jaws.Core.Web.Entities.Pages.Page page = null;
            if(Request.QueryString["pageid"] != null)
            {
                page = (HttpContext.Current.ApplicationInstance as Global).Pages.FindById(Request.QueryString["pageid"]);     
            }
            else
            {
                page = (HttpContext.Current.ApplicationInstance as Global).Pages.FirstOrDefault(p => p.IsHomePage);
            }
           
            Page.Title = page.Title;
            page.Description = page.Description;
            page.Keywords = page.Keywords;

        }
    }
}
